package com.htc.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.htc.model.Consumer;
import com.htc.model.User;

public interface ConsumerMapper {
    
	@Select("SELECT * from consumer ${where}")
    List<Consumer> queryList(@Param("where")String where);
    
	@Insert("insert into consumer(username,password,real_name,email,cellphone,address)"
			+ " values(#{username},#{password},#{real_name},#{email},#{cellphone},#{address})")
    int insert(Consumer consumer);

    @Update("update consumer set"
    		+ " username=#{username},password=#{password},real_name=#{real_name},email=#{email}"
    		+ ",cellphone=#{cellphone},address=#{address} where id=#{id}")
	int update(Consumer consumer);
    
    @Delete("delete from consumer where id=#{id}")
    int del(int id);

    @Select("SELECT * from consumer where username=#{username} and password=#{password}")
	List<Consumer> login(Consumer consumer);
}